package com.eaoa.uc.address.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.pub.PubCityQuery;
import com.eaoa.uc.address.form.PubCityForm;
import com.stony.core.util.CoreUtils;

public class PubCityEditPreAction extends EABaseAction {

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){

		PubCityForm pform = (PubCityForm) form;
		
		Long cityno = CoreUtils.parseLong(pform.getCityno());
		
		if (!isReEntry(request) && cityno!=null ) {
			pform.setVO(PubCityQuery.loadByNo(cityno));
		
		}
		
		if(StringUtils.isBlank(pform.getSort()))
			pform.setSort("99");
		
		return mapping.findForward("success");
	}

}